<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;



class CreatePrivilegesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('privileges', function (Blueprint $table) {
            $table->string('code')->primary();
            $table->string('parent_code')->nullable();
            $table->string('name')->comment('权限名称');
            $table->string('type')->comment('权限菜单类型 menus:菜单 button:按钮');
            $table->string('path')->nullable()->comment('路由');
            $table->string('component')->nullable()->comment('组件名称');
            $table->string('icon')->nullable()->comment('图标');
            $table->string('meta')->nullable()->comment('标题属性');
            $table->string('platform')->nullable()->comment('菜单所属平台：admin 平台 , user 商家或代理');
            $table->string('user_type')->nullable()->comment('1代理 2商户 3操作员');
            $table->unsignedInteger('sort')->nullable()->comment('排序');
        });

        \Illuminate\Support\Facades\DB::statement("alter table `privileges` comment '后台权限表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('privileges');
    }
}
